package com.neusoft.neuiotms.dcom.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractAuditModel;
import com.neusoft.bizcore.web.jpa.model.Comment;
import com.neusoft.neuiotms.dcom.model.enums.ShiftType;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
@Entity
@org.hibernate.annotations.Table(appliesTo = "neuiot_shift", comment = "换班表")
@Table(name = "neuiot_shift")
public class Shift extends AbstractAuditModel {

    private static final long serialVersionUID = 1L;

    /** 源人员名称 */
    @NotBlank(message = "源人员名称不能为空")
    @Length(max = 255, message = "源人员名称不能超过{max}位")
    @Column(length = 255, nullable = false)
    @Comment("varchar(255) NOT NULL COMMENT '源人员名称'")
    private String sourceUserName;

    /** 源人员编码 */
    @NotBlank(message = "源人员编码不能为空")
    @Length(max = 255, message = "源人员编码不能超过{max}位")
    @Column(length = 255, nullable = false)
    @Comment("varchar(255) NOT NULL COMMENT '源人员编码'")
    private String sourceUserCode;

    /** 开始时间 */
    @Column(length = 6, nullable = false)
    @Comment("datetime(6) NOT NULL COMMENT '开始时间'")
    private Date startTime;

    /** 结束时间 */
    @Column(length = 6, nullable = false)
    @Comment("datetime(6) NOT NULL COMMENT '结束时间'")
    private Date endTime;

    /** 替班人员名称 */
    @NotBlank(message = "替班人员名称不能为空")
    @Length(max = 255, message = "替班人员名称不能超过{max}位")
    @Column(length = 255, nullable = false)
    @Comment("varchar(255) NOT NULL COMMENT '替班人员名称'")
    private String targetUserName;

    /** 替班人员编码 */
    @NotBlank(message = "替班人员编码不能为空")
    @Length(max = 255, message = "替班人员编码不能超过{max}位")
    @Column(length = 255, nullable = false)
    @Comment("varchar(255) NOT NULL COMMENT '替班人员编码'")
    private String targetUserCode;

    /** 换班类型 */
    @Enumerated(EnumType.STRING)
    @Column(length = 255, nullable = false)
    @Comment("varchar(255) NOT NULL COMMENT '换班类型'")
    private ShiftType type;

    /** 替班人开始时间 */
    @Column(length = 6, nullable = true)
    @Comment("datetime(6)  NULL DEFAULT NULL COMMENT '替班人开始时间'")
    private Date shiftStartTime;

    /** 替班人结束时间 */
    @Column(length = 6, nullable = true)
    @Comment("datetime(6)  NULL DEFAULT NULL COMMENT '替班人结束时间'")
    private Date shiftEndTime;

    /** 是否确认 */
    @Comment("bit(1) NOT NULL COMMENT '是否确认'")
    private Boolean status = false;

    /** 关联值班安排 */
    @ManyToOne
    private DutyArrangement dutyArrangement;
}
